package com.itheima.config;

import com.alibaba.fastjson.JSON;
import com.itheima.utils.AliSendUtils;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.util.ObjectUtils;

import javax.jms.Queue;
import javax.jms.Topic;
import java.util.Map;

/**
 * @Description: 消息队列
 * @Date :2019-08-30 11:28
 * @Author : yuan_he_song
 */
@Configuration
public class ActiveMqBean {

    public static final String MyQueue = "springboot-p2p";
    public static final String MyTopic = "springboot-topic";

    @Autowired
    private AliSendUtils aliSendUtils;

    @Bean /** 定义存放消息的队列 --点对点 */
    public Queue queue(){
        /** 队列的名称 */
        return new ActiveMQQueue(MyQueue);
    }

    @Bean /** 定义存放消息的队列 --topic模式 */
    public Topic topic(){
        /** 队列的名称 */
        return new ActiveMQTopic(MyTopic);
    }

}
